using System.Collections.Generic;

namespace Intyme.Common.DataModel {
    public class Operation {
        public int ParentComponentID { get; set; }
        public int ID { get; set; }
        public string Name { get; set; }
        public OperationType Type { get; set; }
        public double DefaultOperationTime;
        public List<LinkOperationToMachine> LinksToMachine { get; set; }

        public Operation() {
            ID = -1;
            Name = string.Empty;
            Type = OperationType.None;

            LinksToMachine = new List<LinkOperationToMachine>();

            ParentComponentID = -1;
        }

        public WorkstationType GetWorkstationType() {
            var result = WorkstationType.None;

            switch (Type) {
                case OperationType.Casting:
                case OperationType.CastingPlastic:
                    result = WorkstationType.AluminiumCasting;
                    break;
                case OperationType.ManualCasting:
                    result = WorkstationType.ManualCasting;
                    break;
                case OperationType.CNC:
                case OperationType.Multipurpose:
                    result = WorkstationType.CNC;
                    break;
                case OperationType.Filing:
                case OperationType.Assembly:
                case OperationType.ComplicatedAssembly:
                    result = WorkstationType.Manual1;
                    break;
            }

            return result;
        }
    }
}